﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MindASPCoreWebAPI.ApiLibrary.PermissionsValidation;
using MindASPCoreWebAPI.ApiProject.Controllers;
using MindASPCoreWebAPI.DtoModel.Common;
using MindASPCoreWebAPI.DtoModel.SystemManager;
using MindASPCoreWebAPI.PoModel.SystemManager;
using MindASPCoreWebAPI.Service.SystemManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MindASPCoreWebAPI.ApiProject.Area.SystemManager
{
    [ApiController]
    public class ActivityController : MyBaseController
    {
        public ActivityService _activityService;
        public ActivityController(ActivityService activityService)
        {
            _activityService = activityService;
        }
        [HttpGet]
        public ResultModel<PagerResult<ActivityDto>> ActivityShow(string acti_name, int? type_id, int? actiarea_id,
            string acti_priname, DateTime? minacti_time, DateTime? maxacti_time, int pageindex, int pagesize)
        {
            try
            {
                var list = _activityService.ActivityShow(acti_name, type_id, actiarea_id,
                    acti_priname, minacti_time, maxacti_time, pageindex, pagesize);
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public ResultModel<List<ActiareaModel>> ActiareaList()
        {
            try
            {
                var list = _activityService.ActiareaList();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public ResultModel<List<TypeModel>> TypeList()
        {
            try
            {
                var list = _activityService.TypeList();
                return MyOk(list);

            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpPost]
        public ResultModel<int> ActivityAdd(ActivityAdminModel activityAdminModel)
        {
            try
            {
                var list = _activityService.ActivityAdd(activityAdminModel);
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public ResultModel<ActivityAdminModel> ActivityUpdate(int acti_id)
        {
            try
            {
                var list = _activityService.ActivityUpdate(acti_id);
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpPut]
        public ResultModel<int> ActivityEdit(ActivityAdminModel activityAdminModel)
        {
            try
            {
                var list = _activityService.ActivityEdit(activityAdminModel);
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpDelete]
        public ResultModel<int> ActivityDelete(int acti_id)
        {
            try
            {
                var list = _activityService.ActivityDelete(acti_id);
                return MyOk(list);        

            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public ResultModel<List<IndustryAdminModel>> IndustryAdminList()
        {
            try
            {
                var list = _activityService.IndustryAdminList();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public ResultModel<List<KaModel>> KaList()
        {
            try
            {
                var list = _activityService.KaList();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }

        }
        [HttpGet]
        public ResultModel<List<LangModel>> LangList()
        {
            try
            {
                var list = _activityService.LangList();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public ResultModel<List<HomePage>> DiJia()
        {
            try
            {
                var list = _activityService.DiJia();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
